part of '../find_page.dart';

// 自定义布局，自动,有阴影
Widget _buildSourcePage1() {
  return AlignedGridView.count(
    crossAxisCount: 3,
    mainAxisSpacing: 4,
    crossAxisSpacing: 4,
    itemCount: 50,
    itemBuilder: (context, index) {
      bool isEven = index.isEven;
      return ShowNovelTest(isEven: isEven, index: index, heightC: 180,);
    },
  );
}


// Quilted 建立一个排布模板，按这个排，自动布局
Widget _buildSourcePage2() {
  return GridView.custom(
    gridDelegate: SliverQuiltedGridDelegate(
      crossAxisCount: 4,
      mainAxisSpacing: 4,
      crossAxisSpacing: 4,
      repeatPattern: QuiltedGridRepeatPattern.inverted,
      pattern: [
        QuiltedGridTile(2, 2),
        QuiltedGridTile(1, 1),
        QuiltedGridTile(1, 1),
        QuiltedGridTile(1, 2),
      ],
    ),

    childrenDelegate: SliverChildBuilderDelegate(
          (context, index) {
        // 根据索引设置不同样式
        final isEven = index.isEven;
        return ShowNovelTest(isEven: isEven, index: index, heightC: 0,);
      },
      childCount: 16, // 根据实际需求设置子项数量
    ),

  );
}

// Masonry Grid Layout 自动排版，可以指定item数目
Widget _buildSourcePage3() {
  return MasonryGridView.count(
    crossAxisCount: 3,
    mainAxisSpacing: 4,
    crossAxisSpacing: 4,
    itemCount: 100,
    itemBuilder: (context, index) {
      var isEven = index.isEven;
      return ShowNovelTest(isEven: isEven, index: index, heightC: 180,);
    },
  );
}


//Woven Grid Layout
Widget _buildSourcePage4() {
  return GridView.custom(
    gridDelegate: SliverWovenGridDelegate.count(
      crossAxisCount: 2,
      mainAxisSpacing: 8,
      crossAxisSpacing: 8,
      pattern: [
        WovenGridTile(1),
        WovenGridTile(
          5 / 7,
          crossAxisRatio: 1,
          alignment: AlignmentDirectional.centerEnd,
        ),
      ],
    ),
    childrenDelegate: SliverChildBuilderDelegate(
          (context, index) {
        // 根据索引设置不同样式
        final isEven = index.isEven;
        return ShowNovelTest(isEven: isEven, index: index, heightC: 0,);
      },
      childCount: 16, // 根据实际需求设置子项数量
    ),
  );
}

Widget _buildSourcePage5() {
  return GridView.custom(
    gridDelegate: SliverStairedGridDelegate(
      crossAxisSpacing: 48,
      mainAxisSpacing: 24,
      startCrossAxisDirectionReversed: true,
      pattern: [
        StairedGridTile(0.5, 1),
        StairedGridTile(0.5, 3 / 4),
        StairedGridTile(1.0, 10 / 4),
      ],
    ),
    childrenDelegate: SliverChildBuilderDelegate(
          (context, index) {
        // 根据索引设置不同样式
        final isEven = index.isEven;
        return ShowNovelTest(isEven: isEven, index: index, heightC: 0,);
      },
      childCount: 15, // 根据实际需求设置子项数量
    ),
  );
}